<?php
date_default_timezone_set("PRC");

/**
 * Created by PhpStorm.
 * User: sunshubo
 * Date: 2017/10/20
 * Time: 13:01
 */
class Task_aoshu_model extends MY_Model
{
    function add_task($data)
    {
//        var_dump($data);
        $id = $data['name'];
        $last_date = date("Y.m.d");
        $keshi = $data['keshi'];
        $leam = $data['leam'];
        $rep = $data['rep'];
        $content = $data['content'];
        $tutorId = $data['tutor'];
        $file_list = $data['fileList']; //文件列表
        $sql = /** @lang text */
            "INSERT INTO ws_kc_aoshu(id,last_date,keshi,leam,rep,content,tutorId,file_list) VALUE($id,'$last_date',$keshi,$leam,$rep,'$content',$tutorId,'$file_list')";
//        $this->db->trans_start();
        $query = $this->db->query($sql);
//        $this->db->trans_complete();
        $error = $this->db->error();
        if ($query) {
            return json_encode(array('result' => SUCCESS, 'msg' => $this->config->item('mysql_msg')[$error['code']]));
        }
        return json_encode(array('result' => ERROR, 'msg' => $this->config->item('mysql_msg')[$error['code']], 'code' => $error['code']));
    }
}